package com.happy.main.config.redis;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

/**
 * @program: happy-shopping-op
 * @description: 启动监听
 * @author: taoxinhuan
 * @create: 2020-04-26 21:25
 **/
@Component
@Slf4j
public class RedisInit implements ApplicationListener<ContextRefreshedEvent> {

    @Autowired
    private Subscriber subscriber;

    /**
     * 初始启动quartz
     */
    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) {
        try {
            subscriber.start();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
